/**
 * Created by leon on 2017/4/27.
 */
(function () {
    'use strict';

    angular.module('App.pages.member')
        .controller('MemberOfFamilyCtrl', MemberOfFamilyCtrl);

    function MemberOfFamilyCtrl(id,$scope,MemberModel,$location,$state) {

        $scope.$on('$ionicView.beforeEnter', function (event, viewData) {
            viewData.enableBack = true;
        });




        var vm = this;
        var objParams={};
        $scope.studentInfo = {};
        $scope.relType = {};
        objParams.id='A83FA905F6044E9CA30C52FDCD351794';

        MemberModel.getStudentInfoByParentId(objParams).$promise.then(function(response){
            if(response.stat == 'err'){
                AppUtils.showAlert(response.msg);
            }else{
                vm.studentInfo=response.studentInfo;
                vm.relType=response.relType;
            }
        });

        // MemberModel.getMemberInfo(objParams).$promise.then(function(response){
        //     if(response.stat == 'err'){
        //         AppUtils.showAlert(response.msg);
        //     }else{
        //         vm.memberInfo = response.memberInfo;
        //         console.info(response.memberInfo);
        //     }
        // });
        // $scope.stduentInfo={};
        // objParams.stduentId=studentId;
        // MemberModel.findStudentByParentId(objParams).$promise.then(function (response) {
        //     if(response.stat == 'err'){
        //         AppUtils.showAlert(response.msg);
        //     }else{
        //         vm.studentInfo = response.studentInfo;
        //         console.info(response.studentInfo);
        //     }
        // });
        // $scope.familyInfo={};
        vm.familyInfo = [];
        var obj={};
        obj.memberId= '8F0E9C2C8C2B96498EE8AF60E205838E';
        MemberModel.getfamilyInfo(obj).$promise.then(function(response){
            // if(response.stat == 'err'){
            //     AppUtils.showAlert(response.msg);
            // }else{
                vm.familyInfo=response.familyInfo;
                console.info(vm.familyInfo);
            // }
        });

        $scope.jumpToUrl=function () {
            alert("111");
            // var path='http://192.168.1.173/wechat/#/member/changeRel/A83FA905F6044E9CA30C52FDCD351794';

            // window.location=(path);
            $location.path("/member/changeRel/A83FA905F6044E9CA30C52FDCD351794");
            var curUrl = $state.absUrl();

        }
    }
})();